package ArrayList_1;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

public class testdemo1 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("hello");
        list.add("shujujiegou");
        list.add(1,"dudu");
        //list.remove(0);
        boolean ret = list.remove("hello");
        List<String> s2 = list.subList(0,1);
        System.out.println(s2);
        System.out.println(ret);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

        for (String s:list) {
            System.out.println(s+" ");
        }

       Iterator<String> it = list.iterator();
        while (it.hasNext()){
            System.out.println(it.next()+" ");
        }

        ListIterator<String> it2 = list.listIterator();
        while (it2.hasNext()){
            System.out.println(it2.next()+" ");
        }
       // System.out.println(list);
        List<String> list1 = new ArrayList<>(10);
        List<String> list2 = new ArrayList<>(list);
    }
}
